#ifndef __programmer_H__
#define __programmer_H__
#include "stm32f1xx_hal.h"
#include "main.h"
#include "stdio.h"
#include "string.h"

#define EnableChNumMax      1         //定义编程器通道

typedef struct
{
    uint16_t FlashOk[EnableChNumMax]; //烧录成功数量统计
    uint8_t Status[EnableChNumMax];   //烧录完成标志位
	uint8_t Start;                    //烧录器编程

    uint8_t FW_Buf[1040];             //固件buff
    
}FlashType;

extern FlashType FlashTarget;
extern uint8_t EnableChNum;

void T_CLK_0(void);
void T_CLK_1(void);
void T_DAT_0(void);
void T_DAT_1(void);
void ICP_DAT_OUT_ENABLE(void);
void ICP_DAT_OUT_DISABLE(void);
GPIO_PinState ICP_DAT_Read(uint8_t Ch);

void ProgrammerInit(void);
void ProgrammerIOInit(void);
void ProgrammerWork(FlashType *Target);
void SetTargetPower(uint8_t VoltageType);
uint8_t SaveProgrammNum(FlashType *ProjectFile);


#endif

